API Documentation
Public Member Functions | List of all members
nkImages::ImageBase Class Referenceabstract

Base for all image data classes. More...

Inheritance diagram for nkImages::ImageBase:
nkImages::Image nkImages::ImageView

Public Member Functions

 ImageBase ()
 
 ImageBase (unsigned int width, unsigned int height, PIXEL_FORMAT format)
 
 ImageBase (unsigned int width, unsigned int height, unsigned int depth, PIXEL_FORMAT format, unsigned int pixelByteSize, unsigned int rowByteSize)
 
 ImageBase (const ImageBase &other)
 
 ImageBase (ImageBase &&other)
 
virtual ~ImageBase ()
 
unsigned int getWidth () const
 
unsigned int getHeight () const
 
unsigned int getDepth () const
 
PIXEL_FORMAT getFormat () const
 
unsigned int getPixelByteSize () const
 
unsigned int getRowByteSize () const
 
unsigned int getSliceByteSize () const
 
void setWidth (unsigned int value)
 
void setHeight (unsigned int value)
 
void setDepth (unsigned int value)
 
void setFormat (PIXEL_FORMAT value)
 
void setPixelByteSize (unsigned int value)
 
void setRowByteSize (unsigned int value)
 
void setSliceByteSize (unsigned int value)
 
nkMaths::Vector getPixel (unsigned int x, unsigned int y, unsigned int z=1)
 
virtual unsigned char * getDataPtr () const =0
 
ImageBaseoperator= (const ImageBase &other)
 
ImageBaseoperator= (ImageBase &&other)
 

Detailed Description

Base for all image data classes.

An image holds informations such as the data of the image, its size, alignment in memory... It also offers utilities to access a particular pixel data.

This class family is also the basis for all exchanges in the component. Where data ownership is in play, Image is used. Where no data ownership is needed, ImageView is used.

Constructor & Destructor Documentation

◆ ImageBase() [1/5]

nkImages::ImageBase::ImageBase ( )

Default constructor.

◆ ImageBase() [2/5]

nkImages::ImageBase::ImageBase ( unsigned int  width,
unsigned int  height,
PIXEL_FORMAT  format 
)

Simple 2D constructor.

Parameters
widthThe width of the image, in pixels.
heightThe height of the image, in pixels.
formatThe pixel format of the image.

◆ ImageBase() [3/5]

nkImages::ImageBase::ImageBase ( unsigned int  width,
unsigned int  height,
unsigned int  depth,
PIXEL_FORMAT  format,
unsigned int  pixelByteSize,
unsigned int  rowByteSize 
)

Full constructor.

Parameters
widthThe width of the image, in pixels.
heightThe height of the image, in pixels.
depthThe depth of the image, in number of slices of width * height images.
formatThe pixel format of the image.
pixelByteSizeThe size of a pixel, in bytes.
rowByteSizeThe size of a row, in bytes.

◆ ImageBase() [4/5]

nkImages::ImageBase::ImageBase ( const ImageBase other)

Copy constructor.

Parameters
otherThe base to copy over.

◆ ImageBase() [5/5]

nkImages::ImageBase::ImageBase ( ImageBase &&  other)

Move constructor.

Parameters
otherThe base to move over.

◆ ~ImageBase()

virtual nkImages::ImageBase::~ImageBase ( )
virtual

Destructor.

Member Function Documentation

◆ getWidth()

unsigned int nkImages::ImageBase::getWidth ( ) const
Returns
The width of the image, in pixels.

◆ getHeight()

unsigned int nkImages::ImageBase::getHeight ( ) const
Returns
The height of the image, in pixels.

◆ getDepth()

unsigned int nkImages::ImageBase::getDepth ( ) const
Returns
The depth of the image, in number of slices of width * height images.

◆ getFormat()

PIXEL_FORMAT nkImages::ImageBase::getFormat ( ) const
Returns
The pixel format of the image.

◆ getPixelByteSize()

unsigned int nkImages::ImageBase::getPixelByteSize ( ) const
Returns
The size of a pixel, in bytes.

◆ getRowByteSize()

unsigned int nkImages::ImageBase::getRowByteSize ( ) const
Returns
The size of a row, in bytes.

◆ getSliceByteSize()

unsigned int nkImages::ImageBase::getSliceByteSize ( ) const
Returns
The size of a slice, in bytes.

◆ setWidth()

void nkImages::ImageBase::setWidth ( unsigned int  value)

Sets the width of the image.

Parameters
valueThe width to assign, in pixels.

◆ setHeight()

void nkImages::ImageBase::setHeight ( unsigned int  value)

Sets the height of the image.

Parameters
valueThe height to assign, in pixels.

◆ setDepth()

void nkImages::ImageBase::setDepth ( unsigned int  value)

Sets the depth of the image.

Parameters
valueThe depth to assign, in number of slices of width * height images.

◆ setFormat()

void nkImages::ImageBase::setFormat ( PIXEL_FORMAT  value)

Sets the pixel format.

Parameters
valueThe pixel format image is using.

◆ setPixelByteSize()

void nkImages::ImageBase::setPixelByteSize ( unsigned int  value)

Sets the size of a pixel.

Parameters
valueThe size to assign, in bytes.

◆ setRowByteSize()

void nkImages::ImageBase::setRowByteSize ( unsigned int  value)

Sets the size of a row of the image.

Parameters
valueThe size to assign, in bytes.

◆ setSliceByteSize()

void nkImages::ImageBase::setSliceByteSize ( unsigned int  value)

Sets the size of the depth slices.

Parameters
valueThe size to assign, in number of slices of width * height images.

◆ getPixel()

nkMaths::Vector nkImages::ImageBase::getPixel ( unsigned int  x,
unsigned int  y,
unsigned int  z = 1 
)

Allows to retrieve a pixel at given coordinates. This function abstracts the memory access required to reach given pixel (alignment, sizes...).

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
zThe z coordinate of the pixel, if the texture has a depth.
Returns
The pixel, formatted as a vector to abstract different formats (chars, floats...) and channels given.

◆ getDataPtr()

virtual unsigned char* nkImages::ImageBase::getDataPtr ( ) const
pure virtual

Implemented by the sub-classes which know about how the memory is given.

Returns
A pointer over the image data.

Implemented in nkImages::ImageView, and nkImages::Image.

◆ operator=() [1/2]

ImageBase& nkImages::ImageBase::operator= ( const ImageBase other)

Copy assignment operator.

Parameters
otherThe base to copy and assign.

◆ operator=() [2/2]

ImageBase& nkImages::ImageBase::operator= ( ImageBase &&  other)

Move assignment operator.

Parameters
otherThe base to move and assign.

The documentation for this class was generated from the following file: